<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta name="author" content="Paul Bender" />
    <meta name="copyright" content="2006-2008 Paul Bender &amp; minimyth.org" />
    <meta name="keywords" content="MiniMyth2,Linux,PVR,Linux,MythTV,diskless,RPI3,s905" />
    <meta name="description" content="" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>MiniMyth2 - Documents - Build System Instructions</title>
    <style type="text/css" title="main-styles">
      @import "css/minimyth.css";
    </style>
  </head>
  <body>
    <div class="main">
      <div class="header">
        <div class="heading">MiniMyth2</div>
        <div class="menu">
          <span class="menuItemFirst"><a href="index.html">Home</a></span>
          <span class="menuItem"     ><a href="document.html">Documents</a></span>
          <span class="menuItem"     >Build</span>
        </div>
      </div>
      <div class="middle">
        <div class="heading">Build System Instructions</div>
        <div id="toc" class="section">
          <div class="heading">Table of contents</div>
          <dl>
            <dt><a href="#general">General</a></dt>
            <dt><a href="#prerequisite">Prerequisites</a></dt>
            <dt><a href="#git">Retrieving the build system from the GIT</a></dt>
            <dt><a href="#build">Build instructions</a></dt>
          </dl>
        </div>
        <div id="general" class="section">
          <div class="heading">General</div>
          <p>
            Building MiniMyth2 from sources is quite time consuming process.
            It takes a long time to build and may fail to build on some systems.
          </p>
          <p>
            The build system has three stages:
          </p>
          <ol>
            <li>build the native environment,</li>
            <li>build the cross environment and</li>
            <li>build target MiniMyth2 image</li>
          </ol>
          <p>
            While most packages needed for MiniMyth2 only build their cross versions,
            some of the packages needed for MiniMyth2 such as LLVM, MySQL, some Xorg modules
            need to build their native versions in order to build their cross versions.
          </p>
          <p>
            This long, multi-stage, build process exists to ensure as high as possible independence from the
            local system on which MiniMyth2 is being built.
            Goal with MiniMyth2 build process is to avoid MiniMyth2 binaries to link to or depend on any of local system libraries.
            Also MiniMyth2 build process is removing impact of any differences in local system environment on resulting 
            MiniMyth2 build.
          </p>
          <p>
            Unfortunately, the price for this local system independence is time and disk space.
            For me, on a 3.4GHz Intel i7 3770 computer, running MiniMyth2 development KVM virtual machine with 8 cores, 4GB of RAM 
            assigned and with Archlinux as host for MiniMyth2 build system - a complete build takes approximately 7 hours and 45GB of disk space.
          </p>
        </div>
        <div id="prerequisite" class="section">
          <div class="heading">Prerequisites</div>
          <p>
            The build system assumes that you are building on either an i386 or an x86_64 architecture computer that is running Linux.
            In addition, the build system assumes that you have a basic set of binaries and libraries installed, including:
          </p>
          <ul>
            <li>bison,</li>
            <li>cvs,</li>
            <li>flex,</li>
            <li>gawk,</li>
            <li>gcc[gcc-multilib],</li>
            <li>git,</li>
            <li>grep,</li>
            <li>make,</li>
            <li>mercurial,</li>
            <li>patch,</li>
            <li>subversion,</li>
            <li>texinfo,</li>
            <li>wget,</li>
          </ul>
          <p>
            The build system does its best to check for the presense of any needed binaries at the beginning of the build process.
          </p>
          <p>
            In order to ensure independence from the local system on which MiniMyth2 is being built,
            the build system only uses these binaries and libraries for the early part of the native environment build stage.
            During the native environment build stage,
            the MiniMyth2 build system builds its own versions of these binaries and libraries
            (with the exception of cvs, git and subversion).
          </p>
          <p>
            Some Linux distributions, including
            <a href="http://fedoraproject.org/">Fedora</a>,
            install and use
            <a href="http://ccache.samba.org/">ccache</a>
            as part of their collection of developer packages.
            Unfortunately, ccache breaks the MiniMyth2 build system.
            Therefore, before you attempt to build MiniMyth2,
            make sure that the ccache package is not installed on your system.
          </p>
        </div>
        <div id="git" class="section">
          <div class="heading">Retrieving the build system from the GIT</div>
          <p>
            MiniMyth2 uses GIT as sources control system.
          </p>
          <p>
            To use you will need the GIT client,
            which should be available through your Linux distribution's package management system.
          </p>
          <p>
            Once you have installed the GIT client,
            you can clone MiniMyth2 sources from GIT server located here:
            <a href="https://github.com/warpme/minimyth2.git">MiniMyth2 GIT</a>.
          </p>
          <p>
            Information on how to use GIT can be found in the free online tutorials like in example:
            "<a href="https://try.github.io">try.github.io</a>".
          </p>
        </div>
        <div id="build" class="section">
          <div class="heading">Build instructions</div>
          <p>
            If your local system meets the
            <a href="#prerequisite">prerequisites</a>,
            and you have obtained a copy of the MiniMyth2 build system by
            <a href="#git">Retrieving the build system from the GIT</a>,
            then you are ready to build MiniMyth2.
          </p>
          <p>
            You can build MiniMyth2 by following steps:
          </p>
          <ol>
            <li>
              Configure the build system with your settings in your '$(HOME)/.minimyth2/minimyth.conf.mk' file.
              These settings override the default settings in the build system's '{build-root}/script/minimyth.conf.mk' file,
              where '{build-root}' is the root directory of the MiniMyth2 build system.
              Be sure to set 'mm_HOME' variable in '$(HOME)/.minimyth2/minimyth.conf.mk' with path of the root directory
              of the MiniMyth2 build system.
              The build system does its best to check for stale, incorrect or missing settings,
              but it cannot catch everything.
              Therefore, be sure that your '$(HOME)/.minimyth2/minimyth.conf.mk' file is
              up-to-date and contains correct values for settings that you need for building MiniMyth2.
            </li>
            <li>
              Clean the entire build system by running the command
              'cd&nbsp;{build-root}&nbsp;;&nbsp;make&nbsp;clean'.
            </li>
            <li>
              Download the distribution source files by running the following command
              'cd&nbsp;${build-root}&nbsp;;&nbsp;make&nbsp;garchive'.
              Because some source tarballs are large and some download servers are slow,
              this can take awhile.
            </li>
            <li>
              Build MiniMyth2 by running the following command
              'cd&nbsp;${build-root}/script/meta/minimyth&nbsp;;&nbsp;make&nbsp;build'.
              This is the step that take a long time.
            </li>
            <li>
              Install MiniMyth2 by running the following command
              'cd&nbsp;${build-root}/script/meta/minimyth&nbsp;;&nbsp;make&nbsp;install'.
            </li>
          </ol>
          <p>
            For Ubuntu 16.04 LTS or 19.10 (just those two were tested) quick build guide is folowing:
          </p>
          <ol>
            <li>
              Start terminal and run commands below:
            </li>
            <i>
            <li>
              sudo apt install git bison make cvs flex gawk mercurial subversion texinfo gcc-multilib
            </li>
            <li>
              cd Desktop
            </li>
            <li>
              git clone https://github.com/warpme/minimyth2.git
            </li>
            <li>
              mkdir ../.minimyth2 ../build
            </li>
            <li>
              cp minimyth2/minimyth.conf.mk.example.aarch64 ../.minimyth2/minimyth.conf.mk
            </li>
            </i>
            <li>
             set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to minimyth2 build-root directory
            </li>
            <i>
            <li>
             cd Desktop/minimyth2/script/
            </li>
            <li>
             make garchive
            </li>
            <li>
             cd Desktop/minimyth2/script/meta/minimyth/
            </li>
            <li>
             make build
            </li>
            </i>
          </ol>
          <p>
            For ArchLinux (tested on 20-03-2020 rolling release state) quick build guide is folowing:
          </p>
          <ol>
            <li>
              Start terminal, and run commands below:
            </li>
            <i>
            <li>
              sudo pacman -S bison make cvs flex gawk mercurial subversion texinfo gcc patch wget git which
            </li>
            <li>
              git clone https://github.com/warpme/minimyth2.git
            </li>
            <li>
              mkdir .minimyth2 build
            </li>
            <li>
              cp minimyth2/minimyth.conf.mk.example.aarch64 .minimyth2/minimyth.conf.mk
            </li>
            </i>
            <li>
             set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to minimyth2 build-root directory
            </li>
            <i>
            <li>
             cd minimyth2/script/
            </li>
            <li>
             make garchive
            </li>
            <li>
             cd minimyth2/script/meta/minimyth/
            </li>
            <li>
             make build
            </li>
            </i>
          </ol>
          <p>
            For Fedora (tested on Fedora31) quick build guide is folowing:
          </p>
          <ol>
            <li>
              Start terminal and run commands below:
            </li>
            <i>
            <li>
            sudo dnf install bison make cvs flex gawk mercurial subversion texinfo gcc gcc-c++ patch wget git
            </li>
            <li>
              cd Desktop
            </li>
            <li>
              git clone https://github.com/warpme/minimyth2.git
            </li>
            <li>
              mkdir ../.minimyth2 ../build
            </li>
            <li>
              cp minimyth2/minimyth.conf.mk.example.aarch64 ../.minimyth2/minimyth.conf.mk
            </li>
            </i>
            <li>
             set mm_HOME variable in file $(HOME)/.minimyth2/minimyth.conf.mk to minimyth2 build-root directory
            </li>
            <i>
            <li>
             cd Desktop/minimyth2/script/
            </li>
            <li>
             make garchive
            </li>
            <li>
             cd Desktop/minimyth2/script/meta/minimyth/
            </li>
            <li>
             make build
            </li>
            </i>
          </ol>
          <p>
            While care is taken to make sure the the build system is free of bugs,
            assuming that it is free of bugs would be foolish.
            If a bug in the build system caused the build system to install files in the wrong location,
            then your local system could be crippled.
            Therefore, the build system performs checks to reduce the chance that it will damage the system.
          </p>
          <p>
            First, the build system checks whether or not you are the root user (any user with UID='0' or GID='0').
            If you are the root user, then the build system prints an error message and exits.
            Everything, with the exception of parts of 'make&nbsp;install', can be done as a user with very limited access rights.
          </p>
          <p>
            Second, the build system checks whether or not you have write access to typical system directories.
            If you have write access to any of these directories, then the build system prints an error message and exits.
          </p>
          <p>
            However, 'make&nbsp;install' needs to perform the following operations as root:
          </p>
          <ul>
            <li>copy files to the TFTP and NFS directories, when mm_INSTALL_NFS_ROOT='yes'</li>
          </ul>
          <p>
            As a result, 'make&nbsp;install' may prompt you for the root password,
            depending on your settings in '$(HOME)/{build-root}/minimyth.conf.mk'.
          </p>
        </div>
      </div>
      <div class="footer">
        <hr />
        <div class="valid-xhtml">
          <a href="http://validator.w3.org/check?uri=referer"><img
              src="/image/w3c-valid-xhtml11-blue.gif"
              alt="Valid XHTML 1.1" height="31" width="88" /></a>
        </div>
        <div class="valid-css">
          <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
              src="/image/w3c-valid-css2-blue.gif"
              alt="Valid CSS!"      height="31" width="88" /></a>
        </div>
        <div class="version">
          Last Updated on 2020-04-11
          <br />
          &lt;&nbsp;mailto&nbsp;:&nbsp;warpme&nbsp;at&nbsp;o2&nbsp;dot&nbsp;pl&nbsp;&gt;
        </div>
      </div>
    </div>
  </body>
</html>
